package pt.ua.helpdesk.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface ServiceTicketsAsync {
	/**
	 * Add a ticket
	 * 
	 * @param title Title of the ticket
	 * @param question Question placed by the user
	 * @param status Status of the ticket (1 - Pending; 2 - Solving; 3 - Solved)
	 * @param active Indicates whether the ticket is active or not (1 - Active; 0 - Inactive)
	 * @param idPerson ID of the author of the ticket 
	 * @param callback the callback to return True in case of ticket successfully added, False otherwise
	 */
	void addTicket(String title, String question, Integer status, Integer active, Integer idPerson, AsyncCallback callback);
	/**
	 * Removes a ticket
	 * 
	 * @param idTicket ID of the ticket to be removed
	 * @param callback the callback to return True in case of successful removal, False otherwise
	 */
	void removeTicket(Integer idTicket, AsyncCallback callback);
	/**
	 * Retrieves a list of pending tickets of a given user
	 * 
	 * @param callback the callback to return ArrayList of the pending tickets
	 */
	void getPendingTickets(AsyncCallback callback);
	/**
	 * Retrieves complete data on a ticket, including info and comments
	 *  
	 * @param ticketId ID of the ticket to be searched
	 * @param callback the callback to return An ArrayList containing an ArrayList with the ticket info, and another with the ticket's comments
	 */
	void loadFullTicketData(Integer ticketId, AsyncCallback callback);
	
	/**
	 * Retrieves data necessary to assign a ticket to an assistant
	 *  
	 * @param ticketId ID of the ticket to be searched
	 * @param callback the callback to return An ArrayList containing the ticket info and a list of active assistants 
	 */
	void loadDataForAssignment(Integer ticketId, AsyncCallback callback);
	
	/**
	 * Retrieves a list of tickets on charge of a specific user 
	 * 
	 * @param IDUser ID of the user
	 * @param callback the callback to return ArrayList containing all active tickets of the assistant
	 */
	void getUserTickets(Integer IDUser, AsyncCallback callback);
	
	/**
	 * Retrieves a list of tickets on charge of a specific assistant 
	 * 
	 * @param IDAssistant ID of the assistant
	 * @param callback the callback to return ArrayList containing all active tickets of the assistant
	 */
	void getAssisTickets(Integer IDAssis, AsyncCallback callback);
	
	/**
	 * Adds a comment to a ticket
	 * 
	 * @param authorId ID of the author of the ticket
	 * @param ticketId ID of the ticket
	 * @param text Text of the comment
	 * @param callback the callback to return True in case of successful removal, False otherwise
	 */
	void addComment(Integer authorId, Integer ticketId, String text, AsyncCallback callback) ;
	
	/**
	 * Assign a ticket to an assistant
	 * 
	 * @param assist target of the assignment
	 * @param admin administrator the did the assignment
	 * @param ticket ticket to be assigned
	 * @param callback the callback to return True in case of successful assignment, False otherwise
	 */
	void assignTicket(Integer assist, Integer admin, Integer ticket, AsyncCallback callback) ;
	
	/**
	 * 
	 * @param ticket
	 * @param callback
	 */
	void setTicketAsSolved(Integer ticket, AsyncCallback callback) ;
}
